package cc.yaomm.service.basic.controller.business.user.vo;

import cc.yaomm.common.basic.enums.PermissionTypeEnum;
import cc.yaomm.common.basic.enums.StatusEnum;
import cc.yaomm.common.basic.lang.vo.BaseParamVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Set;

/**
 * Created by XQL on 2021/6/18.
 */
@Data
@ApiModel
public class PermissionParamVO extends BaseParamVO {

    public interface Lock {
    }

    public interface Edit {
    }

    /**
     * 权限ID
     */
    @ApiModelProperty("权限ID")
    @NotNull(message = "权限ID不能为空", groups = Lock.class)
    @Min(value = 0, message = "权限ID必须大于零", groups = Lock.class)
    private Long id;

    @ApiModelProperty("权限名称")
    @NotEmpty(message = "权限名称不能为空", groups = Edit.class)
    @Size(max = 32, message = "权限名称不能超过32个字")
    private String name;

    @ApiModelProperty("权限编码（追加上级编码，以冒号分割）")
    @NotEmpty(message = "权限编码不能为空", groups = Edit.class)
    @Size(max = 64, message = "权限编码不能超过64个字")
    private String code; //

    @ApiModelProperty("权限别名")
    @NotEmpty(message = "权限别名不能为空", groups = Edit.class)
    @Size(max = 64, message = "权限别名不能超过64个字")
    private String alias;

    @ApiModelProperty("权限路由")
    @NotEmpty(message = "权限路由不能为空", groups = Edit.class)
    @Size(max = 64, message = "权限路由不能超过64个字")
    private String router;

    @ApiModelProperty(value = "权限类型", example = "CATALOG-目录,MENU-菜单,BUTTON-按钮")
    @NotNull(message = "权限类型不能为空", groups = Edit.class)
    private PermissionTypeEnum type;

    @ApiModelProperty(value = "图标")
    @Size(max = 64, message = "图标不能超过64个字")
    private String icon;

    /**
     * 状态 1-正常 2-锁定 0-删除
     */
    @ApiModelProperty("状态")
    @NotNull(message = "权限状态不能为空", groups = Lock.class)
    private StatusEnum status;

    @ApiModelProperty(value = "排序值")
    @Max(value = 999999, message = "排序值不能大于999999")
    @Min(value = 1, message = "排序值不能小于1")
    private Integer sort;

    @ApiModelProperty(value = "关联资源集合")
    private Set<String> resources;
}
